<!DOCTYPE html> 
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<title>jQuery Mobile Docs - Collapsible Content</title> 
	<link rel="stylesheet"  href="../../css/themes/default/jquery.mobile-1.2.0.css" />  
	<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>

	<script src="../../js/jquery.js"></script>
	<script src="../../docs/_assets/js/jqm-docs.js"></script>
	<script src="../../js/jquery.mobile-1.2.0.js"></script>

</head> 
<body> 

	<div data-role="page" class="type-interior">

		<div data-role="header" data-theme="f">
		<h1>Collapsible set</h1>
		<a href="../../" data-icon="home" data-iconpos="notext" data-direction="reverse">Home</a>
		<a href="../nav.html" data-icon="search" data-iconpos="notext" data-rel="dialog" data-transition="fade">Search</a>
	</div><!-- /header -->

	<div data-role="content">
		<div class="content-primary">
		<h2>Collapsible set (accordion)</h2>

		<ul data-role="controlgroup" data-type="horizontal" class="localnav">
			<li><a href="content-collapsible-set.html" data-role="button" data-transition="fade" class="ui-btn-active">Basics</a></li>
			<li><a href="content-collapsible-set-options.html" data-role="button" data-transition="fade">Options</a></li>
			<li><a href="content-collapsible-set-methods.html" data-role="button" data-transition="fade">Methods</a></li>
			<li><a href="content-collapsible-set-events.html" data-role="button" data-transition="fade">Events</a></li>
		</ul>

		<p>Collapsible sets start with the exact same markup as <a href="content-collapsible.html">individual collapsibles</a>. By adding a parent wrapper with a <code> data-role="collapsible-set"</code> attribute around a number of collapsibles, the framework will style these to looks like a visually grouped widget and make it behave like an accordion so only one section can be open at a time. View the <a href="../api/data-attributes.html">data- attribute reference</a> to see all the possible attributes you can add to collapsible sets.</p>
		<p>By default, all the sections will be collapsed. To set a section to be open when the page loads, add the <code> data-collapsed="false"</code> attribute to the heading of the section you want expanded.</p>

	<pre><code>		
<strong>&lt;div data-role="collapsible-set"&gt;</strong>

	&lt;div data-role=&quot;collapsible&quot; <strong>data-collapsed=&quot;false&quot;</strong>&gt;
	&lt;h3&gt;Section 1&lt;/h3&gt;
	&lt;p&gt;I&#x27;m the collapsible set content for section 1.&lt;/p&gt;
	&lt;/div&gt;
	
	&lt;div data-role=&quot;collapsible&quot;&gt;
	&lt;h3&gt;Section 2&lt;/h3&gt;
	&lt;p&gt;I&#x27;m the collapsible set content for section 2.&lt;/p&gt;
	&lt;/div&gt;
	
<strong>&lt;/div&gt;</strong>
	</code></pre>	
	

		<p>Here is an example of a collapsible set with 5 sections.</p>
		
		<div data-role="collapsible-set">
			<div data-role="collapsible" data-collapsed="false">
				<h3>Section 1</h3>
				<p>I'm the collapsible content in a set so this feels like an accordion. I'm open by default because I have the <code>data-collapsed="false"</code> attribute.</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 2</h3>
				<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
			</div>
			<div data-role="collapsible" data-collapsed="false">
				<h3>Section 3</h3>
				<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 4</h3>
				<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 5</h3>
				<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
			</div>
		</div>

		<h2>Non-inset collapsible sets</h2>

		<p>For full width collapsibles without corner styling add the <code>data-inset="false"</code> attribute to the set.</p>
		
		<div data-role="collapsible-set" data-inset="false">
			<div data-role="collapsible">
				<h3>I'm a header</h3>
				<p>I'm the collapsible content.</p>
			</div>
			<div data-role="collapsible">
				<h3>I'm a header</h3>
				<p>I'm the collapsible content.</p>
			</div>
			<div data-role="collapsible">
				<h3>I'm a header</h3>
				<p>I'm the collapsible content.</p>
			</div>
		</div>		


		<h2>Mini collapsible sets</h2>

		<p>For a more compact version that is useful in tight spaces, add the <code>data-mini="true"</code> attribute to the set to create a <a href="../forms/forms-all-mini.html">mini version</a>. </p>
		
		<div data-role="collapsible-set" data-theme="c" data-mini="true">
			<div data-role="collapsible">
				<h3>Section 1</h3>
				<p>Collapsible content</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 2</h3>
				<p>Collapsible content</p>

			</div>
			<div data-role="collapsible">
				<h3>Section 3</h3>
				<p>Collapsible content</p>
			</div>
		</div>
		
		<h2>Custom icons</h2>
		<p>Collapsible headings&rsquo; default icons can be overridden by using the <code>data-collapsed-icon</code> and <code>data-expanded-icon</code> attributes, either at the <code>collapsible-set</code> level or on an individual collapsible basis.</p>
		
		<div data-role="collapsible-set" data-theme="c" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d">
			<div data-role="collapsible">
				<h3>Section 1</h3>
				<p>Collapsible content</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 2</h3>
				<p>Collapsible content</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 3</h3>
				<p>Collapsible content</p>
			</div>
		</div>
		
		<h2>Icon positioning</h2>
		<p>Collapsible headings&rsquo; default icon positioning can be overridden by using the <code>data-iconpos</code> attribute, either at the <code>collapsible-set</code> level or on an individual collapsible basis.</p>
		
		<div data-role="collapsible-set" data-theme="c" data-iconpos="right">
			<div data-role="collapsible">
				<h3>Section 1</h3>
				<p>Inherits icon positioning from <code>data-iconpos="right"</code> attribute on parent.</p>
			</div>
			<div data-role="collapsible" data-iconpos="left">
				<h3>Section 2</h3>
				<p>data-iconpos="left"</p>
			</div>
			<div data-role="collapsible" data-iconpos="bottom">
				<h3>Section 3</h3>
				<p>data-iconpos="bottom"</p>
			</div>
			<div data-role="collapsible" data-iconpos="top">
				<h3>Section 4</h3>
				<p>data-iconpos="top"</p>
			</div>
		</div>
		
		
		
		<h2>Theming collapsible content</h2>
		<p>The standard <code>data-theme</code> attribute can be used to set the color of each collapsible in a set. To provide a clearer visual grouping of the content with the headers, add the <code>data-content-theme</code> attribute with a swatch letter. This adds a themed background color and border to the content block. For consistent theming, add these attributes to the parent collapsible set.</p>


<pre><code>		
&lt;div data-role=&quot;collapsible-set&quot; <strong>data-theme=&quot;c&quot; data-content-theme=&quot;d&quot;</strong>&gt;
</code></pre>	


		<div data-role="collapsible-set" data-theme="c" data-content-theme="d">
			<div data-role="collapsible">
				<h3>Section 1</h3>
				<p>Collapsible content</p>
			</div>
			<div data-role="collapsible">
				<h3>Section 2</h3>
				<p>Collapsible content</p>

			</div>
			<div data-role="collapsible">
				<h3>Section 3</h3>
				<p>Collapsible content</p>
			</div>
		</div>

		<h2>Theming individual sections</h2>
		<p>To have individual sections in a group styled differently, add <code>data-theme</code> and <code>data-content-theme</code> attributes to specific collapsibles.</p>

		<div data-role="collapsible-set" data-content-theme="c">
			<div data-role="collapsible" data-theme="b" data-content-theme="b">
				<h3>Section header, swatch B</h3>
				<p>Collapsible content, swatch "b"</p>
			</div>
			<div data-role="collapsible" data-theme="a" data-content-theme="a">
				<h3>Section header, swatch A</h3>
				<p>Collapsible content, swatch "a"</p>
			</div>
			<div data-role="collapsible" data-theme="e" data-content-theme="d">
				<h3>Section header, swatch E</h3>
				<p>Collapsible content, swatch "d"</p>
			</div>
		</div>
		
	</div><!--/content-primary -->		
	
	<div class="content-secondary">
		
		<div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
			
				<h3>More in this section</h3>
				
				<ul data-role="listview" data-theme="c" data-dividertheme="d">
				
					<li data-role="list-divider">Content Formatting</li>
					<li><a href="content-html.html">Basic HTML styles</a></li>
					<li><a href="content-grids.html">Layout grids (columns)</a></li>
					<li><a href="content-collapsible.html">Collapsible content blocks</a></li>
					<li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
					<li><a href="content-themes.html">Theming content</a></li>
	
				</ul>
		</div>
	</div>		

</div><!-- /content -->

<div data-role="footer" class="footer-docs" data-theme="c">
		<p class="jqm-version"></p>
		<p>&copy; 2012 jQuery Foundation and other contributors</p>
</div>
	
</div><!-- /page -->

</body>
</html>
